﻿using ReflectionStudio.Core.Events;
using System;
using System.Windows;
namespace WPFExcelReport
{
    /// <summary>
    /// Interaction logic for SETUPABON.xaml
    /// </summary>
    public partial class TDB02
    {
       
        ITXEXRPT ITXEXRPT;
        
        public TDB02()
        {
            InitializeComponent();
            MV = new VICC_QUERYTB();
            this.DataContext = MV;
            INFO = "SELECT * FROM ABPOS WHREE ABPAUFKRS='X4'";
            INFO = "SELECT * FROM SDDAT WHERE SDSA='0267'";
            ART = "SDDAT";
        }
        public override void QueryCommand(object sender, RoutedEventArgs e)
        {
            try
            { 
                MV.or1 = MV.OracleDB.CreateCommand();
                MV.or1.CommandText = INFO;
                SResult = MV.Connect2Proxy(MV.or1);
                SResult.Tables[0].TableName = ART.Trim();
                vwMaster.Source = SResult.Tables[0];
                MergeData(SResult, false, false);            

            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            base.QueryCommand(sender, e);
        } 
        private void PrintCommand(object sender, EventArgs e)
        {
            if (ITXEXRPT == null)
            {
                ITXEXRPT = new ITXEXRPT();
                ITXEXRPT.Root = "C:\\IntexReport";
                ITXEXRPT.strCompany = app.company;
                ITXEXRPT.PrintType = "OpenExcel";
            }
        
            ITXEXRPT.dsSource= SResult;
            ITXEXRPT.DocType = "ABCOMPARE";
            ITXEXRPT.strExcelFile = @"ITX\ITXABDOC.xls";
            string filename = (string)ITXEXRPT.WriteExcelReport();
        }

        private void ABCommand(object sender, RoutedEventArgs e)
        {
            VICC_WFEVENTS.SVWF.DBAB(this.RUNID);
        }
    }
}
